package cn.com.wangluotongxin.chat.model.constants;

public enum ChatSendStatus {

    START_SEND(1, "发送中"),
    END_SEND(2, "结束发送"),
    FAIL_SEND(3, "发送失败"),
    READ(4, "已读");

    private Integer code;
    public Integer getCode(){
        return this.code;
    }

    private String name;
    public String getName(){
        return this.name;
    }

    public static ChatSendStatus getByCode(Integer code){
        if(code == null){
            return null;
        }else {
            ChatSendStatus[] chatSendStatuses = values();
            for(ChatSendStatus chatSendStatus : chatSendStatuses){
                if(chatSendStatus.getCode().equals(code)){
                    return chatSendStatus;
                }
            }
        }
        return null;
    }

    ChatSendStatus(Integer code, String name){
        this.code = code;
        this.name = name;
    }
}
